<template>
  <div id="application">
    <el-row>
      <el-col>
        <el-result icon="warning" v-if="statu==1" title="申请提示" subTitle="还未入驻称为商家">
          <template slot="extra">
            <el-button type="primary" size="medium" @click="addRegister">申请商家</el-button>
          </template>
        </el-result>
        <el-result icon="error" v-if="statu==2" title="驳回提示" subTitle="请查看原因修改申请">
              <template slot="extra">
                <el-button type="primary" size="medium" @click="showReason">查看驳回原因</el-button>
                <el-button type="primary" size="medium" @click="update">修改申请</el-button>
              </template>
            </el-result>
            <el-result icon="info" v-if="statu==3" title="审核中" subTitle="请等待审核结果">
                  <template slot="extra">
                    <el-button type="primary" size="medium" @click="update">修改申请</el-button>
                  </template>
                </el-result>
      </el-col>
      </el-row>


<el-dialog
  title="驳回原因"
  :visible.sync="showReasonWindow"
  width="30%"
  :before-close="handleClose">
  <el-input
    type="textarea"
    :rows="2"
    placeholder=""
    disabled
    v-model="store.rejectReason">
  </el-input>
  <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="showReasonWindow = false">确 定</el-button>
  </span>
</el-dialog>
</div>
</template>

<script>
  export default {
    name: 'Application',
    data() {
      return{
        statu: 0,
        showReasonWindow:false,
        store:{
          storeName:"",
          address:"",
          phone:"",
          rejectReason:"",
          linkman:"",
          createUser:"",
          createDate:"",
          license:"",
          permit:""
        }

      }
    },
    methods:{
      addRegister(){
        this.$router.push('/registerform');
      },
      checkFormed(){
        this.$http.get("/storeRegister/checkFormed").then(resp=>{
          this.statu = resp.data.data
        })
      },
      update(){
        this.$router.push("/updateRegisterform")
      },
      showReason(){
        this.$http.get("/storeRegister/message").then(resp=>{
          this.store.rejectReason = resp.data.data.rejectReason
        })
        this.showReasonWindow = true;

      }

    },
    created(){
      this.checkFormed()
    }
  }
</script>

<style scoped>
  #application{
    height: 600px;
  }

</style>
